import {getEx} from './crud'
import moment from 'moment'
export function getView(tid){
    return new Promise((re,rej)=>{
        if(tid == undefined){
            re({})
            return
        }
        getEx("data/view/"+tid).then((data)=>{
            if(data && data.data && data.data.result){
                let view = data.data.result
                if (view && view.values) {
                    view.values.forEach(v => {
                        v.picktime = moment.unix(v.pick_time). format()
                    })
                }
                re(view)
            }
        }).catch(err=>{
            rej(err)
        })
    })
    
}


